package com.adcc.monitoragent.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * ip 唯一确定
 * 操作系统监控，内存，CPU，线程
 * 
 * @author charlie
 * 
 */
public class OsBean extends BaseBean {

	private static final long serialVersionUID = 1L;
	/**
	 * 固定窜
	 */
	private  String fixType = "os";
	private String osArch;// 体系结构
	private String osName;// 操作系统
	private String osFdMax;// 系统最大打开文件数
	private String osMemoryTotal;// 总内存
	private String osMemoryFree;// 空闲内存
	private String osMemoryUsePercent;// 内存使用率
	private String osSwapTotal;// 总交换分区
	private String osSwapFree;// 空闲交换分区使用率
	private String osSwapUsePercent;// 交换分区
	private String osProcessors;// 处理器数目
	private String osCpuRatio;// CPU占用率
	private List<Disk> osDiskList = new ArrayList<Disk>();// 各磁盘占用率 ，比较重要，防止磁盘满了，业务停止
	private List<Net> osNetList = new ArrayList<Net>();//  网卡使用情况
	
	public OsBean() {
		super();
	}

	public OsBean(String key) {
		super();
		this.ip = key;
	}

	public String getOsArch() {
		return osArch;
	}

	public void setOsArch(String osArch) {
		this.osArch = osArch;
	}

	public String getOsName() {
		return osName;
	}

	public void setOsName(String osName) {
		this.osName = osName;
	}

	public String getOsMemoryTotal() {
		return osMemoryTotal;
	}

	public void setOsMemoryTotal(String osMemoryTotal) {
		this.osMemoryTotal = osMemoryTotal;
	}

	public String getOsMemoryFree() {
		return osMemoryFree;
	}

	public void setOsMemoryFree(String osMemoryFree) {
		this.osMemoryFree = osMemoryFree;
	}

	public String getOsSwapTotal() {
		return osSwapTotal;
	}

	public void setOsSwapTotal(String osSwapTotal) {
		this.osSwapTotal = osSwapTotal;
	}

	public String getOsSwapFree() {
		return osSwapFree;
	}

	public void setOsSwapFree(String osSwapFree) {
		this.osSwapFree = osSwapFree;
	}

	public String getOsProcessors() {
		return osProcessors;
	}

	public void setOsProcessors(String osProcessors) {
		this.osProcessors = osProcessors;
	}

	public String getOsCpuRatio() {
		return osCpuRatio;
	}

	public void setOsCpuRatio(String osCpuRatio) {
		this.osCpuRatio = osCpuRatio;
	}
	
	public List<Disk> getOsDiskList() {
		return osDiskList;
	}

	public void setOsDiskList(List<Disk> osDiskList) {
		this.osDiskList = osDiskList;
	}

	public String getOsMemoryUsePercent() {
		return osMemoryUsePercent;
	}

	public void setOsMemoryUsePercent(String osMemoryUsePercent) {
		this.osMemoryUsePercent = osMemoryUsePercent;
	}

	public String getOsSwapUsePercent() {
		return osSwapUsePercent;
	}

	public void setOsSwapUsePercent(String osSwapUsePercent) {
		this.osSwapUsePercent = osSwapUsePercent;
	}

	public List<Net> getOsNetList() {
		return osNetList;
	}

	public void setOsNetList(List<Net> osNetList) {
		this.osNetList = osNetList;
	}

	public static class Disk  implements Serializable {
		private static final long serialVersionUID = 1L;
		/**
		 * 磁盘名称
		 */
		private String name;
		/**
		 * 磁盘路径
		 */
		private String path;
		/**
		 * 磁盘类型
		 */
		private String type;
		/**
		 * 总大小
		 */
		private String total;
		/**
		 * 空闲大小
		 */
		private String free;
		/**
		 * 磁盘使用率
		 */
		private String usePercent;
		/**
		 * 读字节
		 */
		private String reads;
		/**
		 * 写字节
		 */
		private String writes;
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public String getUsePercent() {
			return usePercent;
		}
		public void setUsePercent(String usePercent) {
			this.usePercent = usePercent;
		}
		public String getReads() {
			return reads;
		}
		public void setReads(String reads) {
			this.reads = reads;
		}
		public String getWrites() {
			return writes;
		}
		public void setWrites(String writes) {
			this.writes = writes;
		}
		public String getPath() {
			return path;
		}
		public void setPath(String path) {
			this.path = path;
		}
		public String getType() {
			return type;
		}
		public void setType(String type) {
			this.type = type;
		}
		public String getTotal() {
			return total;
		}
		public void setTotal(String total) {
			this.total = total;
		}
		public String getFree() {
			return free;
		}
		public void setFree(String free) {
			this.free = free;
		}
		@Override
		public String toString() {
			return "Disk [name=" + name + ", path=" + path + ", type=" + type
					+ ", total=" + total + ", free=" + free + ", usePercent="
					+ usePercent + ", reads=" + reads + ", writes=" + writes
					+ "]";
		}
	}
	/**
	 * mac确定一条记录
	 * 接收 和发送 包  都不为零，记录一条数据
	 * @author charlie
	 *
	 */
	public static class Net  implements Serializable {
		private static final long serialVersionUID = 1L;
		private String mac;//物理地址
		private String rxPackets;//接收的总包裹数
		private String rxPacketsPer;//接收的包裹数每一段时间
		private String txPackets;//发送的总包裹数
		private String txPacketsPer;//发送的包裹数每一段时间
		private String rxData;//接收到的总数据     单位K  尽量可配置
		private String rxDataPer;//接收到总数据每一段时间
		private String txData;//发送的总数据
		private String txDataPer;//发送总数据每一段时间
		private String rxErrors;//接收到的错误包数
		private String txErrors;//发送数据包时的错误数
		private String rxDropped;//接收时丢弃的包数
		private String txDropped;//发送时丢弃的包数
		public String getMac() {
			return mac;
		}
		public void setMac(String mac) {
			this.mac = mac;
		}
		public String getRxPackets() {
			return rxPackets;
		}
		public void setRxPackets(String rxPackets) {
			this.rxPackets = rxPackets;
		}
		public String getRxPacketsPer() {
			return rxPacketsPer;
		}
		public void setRxPacketsPer(String rxPacketsPer) {
			this.rxPacketsPer = rxPacketsPer;
		}
		public String getTxPackets() {
			return txPackets;
		}
		public void setTxPackets(String txPackets) {
			this.txPackets = txPackets;
		}
		public String getTxPacketsPer() {
			return txPacketsPer;
		}
		public void setTxPacketsPer(String txPacketsPer) {
			this.txPacketsPer = txPacketsPer;
		}
		public String getRxData() {
			return rxData;
		}
		public void setRxData(String rxData) {
			this.rxData = rxData;
		}
		public String getRxDataPer() {
			return rxDataPer;
		}
		public void setRxDataPer(String rxDataPer) {
			this.rxDataPer = rxDataPer;
		}
		public String getTxData() {
			return txData;
		}
		public void setTxData(String txData) {
			this.txData = txData;
		}
		public String getTxDataPer() {
			return txDataPer;
		}
		public void setTxDataPer(String txDataPer) {
			this.txDataPer = txDataPer;
		}
		public String getRxErrors() {
			return rxErrors;
		}
		public void setRxErrors(String rxErrors) {
			this.rxErrors = rxErrors;
		}
		public String getTxErrors() {
			return txErrors;
		}
		public void setTxErrors(String txErrors) {
			this.txErrors = txErrors;
		}
		public String getRxDropped() {
			return rxDropped;
		}
		public void setRxDropped(String rxDropped) {
			this.rxDropped = rxDropped;
		}
		public String getTxDropped() {
			return txDropped;
		}
		public void setTxDropped(String txDropped) {
			this.txDropped = txDropped;
		}
		@Override
		public String toString() {
			return "Net [mac=" + mac + ", rxPackets=" + rxPackets
					+ ", rxPacketsPer=" + rxPacketsPer + ", txPackets="
					+ txPackets + ", txPacketsPer=" + txPacketsPer
					+ ", rxData=" + rxData + ", rxDataPer=" + rxDataPer
					+ ", txData=" + txData + ", txDataPer=" + txDataPer
					+ ", rxErrors=" + rxErrors + ", txErrors=" + txErrors
					+ ", rxDropped=" + rxDropped + ", txDropped=" + txDropped
					+ "]";
		}
	}
	
	public String getOsFdMax() {
		return osFdMax;
	}

	public void setOsFdMax(String osFdMax) {
		this.osFdMax = osFdMax;
	}

	@Override
	public String toString() {
		return "OsBean [fixType=" + fixType + ", osArch=" + osArch
				+ ", osName=" + osName + ", osFdMax=" + osFdMax
				+ ", osMemoryTotal=" + osMemoryTotal + ", osMemoryFree="
				+ osMemoryFree + ", osMemoryUsePercent=" + osMemoryUsePercent
				+ ", osSwapTotal=" + osSwapTotal + ", osSwapFree=" + osSwapFree
				+ ", osSwapUsePercent=" + osSwapUsePercent + ", osProcessors="
				+ osProcessors + ", osCpuRatio=" + osCpuRatio + ", osDiskList="
				+ osDiskList + ", osNetList=" + osNetList + "]";
	}

	public String getFixType() {
		return fixType;
	}
	/**
	 * 获取关键字唯一标识
	 * @return
	 */
	public String buildKey() {
		return this.ip;
	}
	/**
	 * 获取展现名称   ip
	 */
	public void setShowName() {
		String name = "";
		setShowName("Os");
	}
}
